package com.victor9ac.mashup.usecase.auxiliary;

import java.util.ArrayList;
import java.util.List;

import com.victor9ac.mashup.api.Transport;

public class TravelGetTransportFromR2R extends TravelGetTransport {

	public void getTransportByName(String name) {

		List<Transport> transport = new ArrayList<Transport>();

		String[] routeNameList = name.split(REGEX_SEPARATOR);

		for (int i = 0; i < routeNameList.length; i++) {
			String s = routeNameList[i];
			s = s.toLowerCase();

			extracted(transport, s);

		}
	}

	private void extracted(List<Transport> transport, String s) {
		if (s.contains("bus")) {
			transport.add(Transport.BUS);
		} else if (s.contains("train")) {
			transport.add(Transport.TRAIN);
		} else if (s.contains("fly")) {
			transport.add(Transport.PLANE);
		} else if (s.contains("car")) {
			transport.add(Transport.CAR);
		} else if (s.contains("walk")) {
			transport.add(Transport.WALK);
		}
	}

}
